# -*- mode: org; fill-column: 80; -*-
#+TITLE: Org Mode Table
#+SUBTITLE: Examples
#+AUTHOR: Zelphir Kaltstahl
#+STARTUP: content
#+STARTUP: indent
#+STARTUP: align
#+STARTUP: shrink
#+STARTUP: inlineimages
#+STARTUP: entitiesplain
#+STARTUP: nologdone
#+STARTUP: nologreschedule
#+STARTUP: nologredeadline
#+STARTUP: nologrefile
#+STARTUP: hidestars
#+STARTUP: oddeven
#+TODO: TODO WIP | DONE
#+DATE: [2022-03-20 So]
#+LANGUAGE: English
#+PRIORITIES: A C C
#+EXCLUDE_TAGS: noexport

* Example 01

This example contains the following things:

+ table name using ~#+NAME: ...~ above the table
+ alignment using alignment markers like ~<r>~ aligning the text of columns
  + also note the ~#+STARTUP: align~ in the header of this file
+ column width markers like ~<20>~ limiting the number of column displayed
  + also note the ~#+STARTUP: shrink~ in the header of this file
+ first column markers
  + marking a row as containing cell references using ~_~ in the first column
  + marking a row to be recalculated, when navigating through the table using ~#~ in the first column
  + marking a row as containing column references using ~!~ in the first column
+ enabler column / enable bit taken into account by formula using ~inner(mul,add, ..., ...)~
+ usage of /remote/ table values using ~remote(..., ...)~
+ formulas
  + column formula using only a column specifier like ~$4~ instead of specifying both row and column
  + vertical sum of a section of cells using ~vsum~ and section specifier like ~@II~
  + calculating days from timestamps using ~date~
  + calculating time using ~;T~ formatter
  + interpreting cell values as numeric using the ~;N~ formatter
  + interpreting empty cells as zero using the ~;E~ formatter

#+NAME: table1
|   |             col1 heading |          col2 heading | col3 heading | enable for sum |
|---+--------------------------+-----------------------+--------------+----------------|
|   |                    <r20> |                 <r20> | <l20>        |      <c>       |
| _ |                cell_ref1 |             cell_ref2 | cell_ref3    |                |
| # |                        7 |                     8 | 15.00        |                |
|---+--------------------------+-----------------------+--------------+----------------|
| ! |                   addend |                augent | result       |                |
| # |                        1 |                     2 | 3.00         |       1        |
| # |                        3 |                     4 | 7.00         |       1        |
| # |                        5 |                     6 | 11.00        |       0        |
|---+--------------------------+-----------------------+--------------+----------------|
| # |                    COUNT |                       | 0.00         |       2        |
| # |                      SUM |                       | 0.00         |     10.00      |
| # | RESULT WITH REMOTE VALUE |                       | 0.00         |     110.00     |
|---+--------------------------+-----------------------+--------------+----------------|
| # |                    DATE1 | [2022-03-20 So 10:00] | 0.00         |                |
| # |                    DATE2 | [2022-03-20 So 18:00] | 0.00         |                |
| # |        DATE DIFF IN DAYS |                 -0.33 | -0.33        |                |
|---+--------------------------+-----------------------+--------------+----------------|
| # |               START TIME |                     0 | 0.00         |                |
| # |             HOURS PASSED |                     8 | 8.00         |                |
| # |                 TIME NOW |              08:00:00 | 8.00         |                |
#+TBLFM: $4=$2 + $3;EN%.2f::@9$5=vsum(@II$5..@III$5);::@10$5=inner(mul,add,@II$4..@III$4,@II$5..@III$5);EN%.2f::@11$5=@10$5 + remote(table_with_value,@2$2);EN%.2f::@14$3=date(<@12$3>)-date(<@13$3>);%.2f::@17$3=(@15$3 + (@16$3 * 60 * 60);T

#+NAME: table_with_value
|       | heading |
|-------+---------|
| value |     100 |
